<template>
	<div class="body">
		<div class="cont">
			<div class="title">登录密码重置</div>
			<div>
				<div class="worlds">
					<span>>身份验证</span>
					<span>>登录密码重置</span>
					<span>>重置完成</span>
				</div>
				<div class="line"><img src="../../../static/img/line.png" alt=""></div>
			</div>
			<div class="phone">
				<label>手机号：<input class="text" id="text" type="text" placeholder="请输入手机号"></label>
			</div>
			<div class="next" @click="next"><input type="button" >下一步</div>
		</div>
	</div>
</template>

<script>
import axios from 'axios'
export default{
	name:'Surephone',
	data(){
		return{
			
		}
	},
	methods:{
		next(){
			var phone = document.getElementById('text').value*1;
			// console.log(typeof(phone))
			axios.post(('http://localhost:3000/api/user/getPhone'),{
				phone:phone
			}).then((response)=>{
				// console.log(response.data)
				var ph = []
				for(var i = 0; i < response.data.length; i++){
					// console.log(typeof(response.data.length))
					// console.log('phone:'+phone)
					// console.log(response.data[i].phone)
					ph.push(response.data[i].phone)
				}
				// console.log(ph)
				for(var i = 0; i < ph.length; i++){
					// console.log(ph[i])
					if(phone == ph[i]){
						this.$router.push({path:'/resetpassword',query:{phone:phone}})
						return false
					}
				}
				alert('该手机未注册');
			})
			// this.$router.push({path:'/resetpassword',query:{phone:phone}})
		}
	}
}
</script>

<style scoped="scoped">
.body{
	position: relative;
	top: 0;
	padding-top: 80px;
	padding-bottom: 50px;
	/* padding-left: 200px; */
	background-image: url(../../../static/img/zhuce_bj.jpg);
	background-size: 100% 100%;
}
.cont{
	width: 1000px;
	height: 500px;
	margin: auto;
	background: #ffffff8c;
}
.title{
	font-size: 22px;
	font-weight: 800;
	text-align: center;
	padding-top: 40px;
	color: #00B7FF;
}
.worlds{
	width: 100%;
	padding-bottom: 10px;
	padding-top: 50px;
}
.worlds span:first-child{
	color: #00B7FF;
	padding-left: 184px;
}
.worlds span:nth-child(2){
	padding-left: 195px;
}
.worlds span:nth-child(3){
	padding-left: 202px;
}
.line{
	text-align: center;
}
.phone{
	padding-top: 80px;
	padding-left: 220px;
	font-size: 16px;
}
.text{
	margin-left: 15px;
	height: 40px;
	width: 280px;
	background: #efefef;
	padding-left: 15px;
}
.text:hover{
	border: 1px solid #00B7FF;
}
.next{
	width: 200px;
	height: 40px;
	line-height: 40px;
	text-align: center;
	font-size: 18px;
	font-weight: 600;
	color: #FFFFFF;
	margin-top: 60px;
	margin-left: 230px;
	background: #00B7FF;
}
.next:hover{
	cursor: pointer;
}
</style>
